<!-- //我的行程 -->
<template>
	<view class="myJourney">
		<view class="myJourney_ul">
			<view class="" v-for="(item,index) in list" :key="index">
				<!-- 班车 S -->
				<view class="myJourney_li tp-mb20" v-if="item.travelType == 0">
					<view class="myJourney_li_head flex flex_between">
						<view class="tp-ptb0lr20 tp-h56 center_combo yellow-bg tp-fcF tp-br40">
							时间：{{item.useTime}}
						</view>
						<view class="tp-fc">班车</view>
					</view>
					<view class="myJourney_li_main" @click="handleGoBusOrderDetail(item)">
						<view class="myJourney_li_main_top flex align_center flex_between">
							<view class="myJourney_li_main_top_l flex align_center">
								<view class="myJourney_li_main_top_l_btn flex align_center flex_center">班车</view>
								<view class="myJourney_li_main_top_l_time">发车时间：{{item.startDay}}</view>
							</view>
							<view class="myJourney_li_main_top_r">{{item.orderDesc || '待使用'}}</view>
						</view>
						<view class="myJourney_li_main_con">
							<view class="shift-wrap">
								<view class="from">
									<text class="time">{{item.departureTime}}</text>
									<text class="address">{{item.startStation}}</text>
								</view>
								<view class="bus_type-wrap">
									<text class="but_type">{{item.shiftsCartype}}</text>
									<view class="dack"></view>
									<text class="duration">历时{{item.travelTime}}分钟</text>
								</view>
								<view class="to">
									<text class="time">{{item.arriveTime}}</text>
									<text class="address">{{item.arriveStation}}</text>
								</view>
							</view>
						</view>
					</view>
				</view>
				<!-- 班车 E -->
				
				<!-- 拼车 S -->
				<view class="tp-mb20" v-if="item.travelType == 1">
					<view class="level_align flex_between">
						<view class="tp-ptb0lr20 tp-h56 center_combo yellow-bg tp-fcF tp-br40">
							时间：{{item.useTime}}
						</view>
						<view class="tp-fc">拼车</view>
					</view>
					<view class="info_top-wrap tp-bgf tp-mt20">
						<view class="date">
							<text class="type">拼车</text>
							拼车时间：{{item.time}}
						</view>
						<view class="status">
							<view>{{item.statusDesc}}</view>
						</view>
					</view>
					
					<view class="info_content-wrap  tp-bgf tp-pd30" @click="pageJumps('/pagesUser/order/carpool.orderDetail?orderStatus=noTraveling' + '&id=' + item.orderNo)">
						<view class="address-wrap">
							<view class="step-wrap">
								<view class="dot dot_from"></view>
								<view class="dot dot_to"></view>
							</view>
							<view class="from">
								<text class="txt ellispsis1">{{item.startStation}}</text>
							</view>
							<view class="to">
								<text class="txt ellispsis1">{{item.endStation}}</text>
							</view>
						</view>
						<view class="price" v-if="curNavbar.alias==='addOrder'"><text style="font-size: 24rpx;">￥</text> {{item.price}}</view>
						<view class="price" v-else><text style="font-size: 24rpx;">￥</text> {{item.price}}</view>
					</view>
				</view>
				<!-- 拼车 E -->
				
				<!-- 包车 S -->
				<view class="tp-mb20" v-if="item.travelType == 2">
					<view class="level_align flex_between">
						<view class="tp-ptb0lr20 tp-h56 center_combo yellow-bg tp-fcF tp-br40">
							时间：{{item.useTime}}
						</view>
						<view class="tp-fc">包车</view>
					</view>
					<view class="info_top-wrap tp-bgf tp-mt20">
						<view class="date">
							<text class="type">包车</text>
							包车时间：{{item.time || ''}}
						</view>
						<view class="status">
							<view>{{item.baocheUserStatusVo || ''}}</view>
						</view>
					</view>
					
					<view class="info_content-wrap tp-bgf tp-pd30" @click="pageJumps('/pagesUser/order/chartered.orderDetail?orderStatus=noTraveling' + '&id=' + item.orderNo)">
						<view class="address-wrap">
							<view class="step-wrap">
								<view class="dot dot_from"></view>
								<view class="dot dot_to"></view>
							</view>
							<view class="from">
								<text class="txt ellispsis1">{{item.startStation || ''}}</text>
							</view>
							<view class="to">
								<text class="txt ellispsis1">{{item.endStation || ''}}</text>
							</view>
						</view>
						<view class="price"><text style="font-size: 24rpx;">￥</text> {{item.price || ''}}</view>
						<!-- <image v-if="item.orderType === 'CIRCLE'" class="dack-img" src="/pagesUser/static/toandfor-icon.png"></image> -->
					</view>
				</view>
				<!-- 包车 E -->
				
				<!-- 租车 S -->
				<view class="tp-mb20" v-if="item.travelType == 3">
					<view class="level_align flex_between">
						<view class="tp-ptb0lr20 tp-h56 center_combo yellow-bg tp-fcF tp-br40">
							时间：{{item.useTime}}
						</view>
						<view class="tp-fc">租车</view>
					</view>
					<view class="info_top-wrap tp-bgf tp-mt20">
						<view class="date">
							<text class="type">租车</text>
							租车时间：{{item.time}}
						</view>
						<view class="status">
							<view>{{item.zucheStatus}}</view>
						</view>
					</view>
					
					<view class="info_content-wrap tp-bgf tp-pd30" @click="pageJumps('/pagesUser/order/rent.orderDetail?orderStatus=waitingCar'+ '&id=' + item.orderNo)">
						<view class="address-wrap">
							<view class="from">
								<text class="type">取</text>
								<text class="txt ellispsis1">{{item.startStation}}</text>
							</view>
							<view class="to">
								<text class="type">还</text>
								<text class="txt ellispsis1">{{item.endStation}}</text>
							</view>
						</view>
						<view class="price"><text style="font-size: 24rpx;">￥</text> {{item.price}}</view>
					</view>
				</view>
				<!-- 租车 E -->
				
				<!-- 景区 S -->
				<view class="tp-mt20" v-if="item.travelType == 11">
					<view class="level_align flex_between">
						<view class="tp-ptb0lr20 tp-h56 center_combo yellow-bg tp-fcF tp-br40">
							时间：{{item.useTime}}
						</view>
						<view class="tp-fc">景区</view>
					</view>
					<view class="list-box tp-mt20 ">
						<view class="tp-br12 tp-ptb0lr30 tp-bgf  tp-mb2" @click="pageJumps('./order/scenicOrderDetail?id=' + item.orderId)">
							<view class=" level_align  flex_between tp-fc333 tp-h88 tp-fz28">
								<view class="level_align">
									<text>订单号：</text>
									<text>{{item.orderNo}}</text>
								</view>
								<text class="tp-fz26 " :class="curSwiperIndex == 4 ? 'tp-red' : 'tp-yellow'">{{item.orderDesc}}</text>
							</view>
							<view class="level_align ">
								<image class="list-img tp-br12 tp-mr20" :src="wwwImgUrl + item.jqCover" mode=""></image>
								<view class="flex-1 flex flex_column flex_between" style="height: 160rpx;">
									<view class=" tp-fc333  tp-fz28">
										<view class="ellispsis1 tp-fw600">
											{{item.jqName}}
										</view>
										<view class="tp-mt10 tp-fz24 tp-fc666">
											使用时期: {{item.useTime}}
										</view>
									</view>
									<view class="level_align tp-fz24 tp-fc666 flex-1 tp-mr20">
										<text class="ellispsis1" v-if="items.num != 0" v-for="items in item.ticketIntroVoList" :key='items.id'>{{items.ticketsName}}{{items.num}}张、</text>
									</view>
								</view>
							</view>
							<view class="level_align tp-h72 tp-fc333 flex_between">
								<view class="level_align">
									<text>下单:</text><text>{{item.createTime || '2020-12-12 12:12:12'}}</text>
								</view>
								<view class="level_align flex_end">
									<text class="tp-mr20"> 共{{item.num}}件商品</text>
									<text>{{item.status==0 ? '需付':'实付'}}￥{{item.totalRealAmount}}</text>
								</view>
							</view>
						</view>
						<!-- <view class="btm-radius  tp-h98 level_align flex_end tp-bgf " v-if="[1,5].includes(item.status - 0)">
							<view v-if="[1,5].includes(item.status - 0)" @click="handeScenicRefundDect(item)" class="btn tp-ptb0lr20 tp-h56 center_combo tp-bcF5 tp-br12 tp-fc666 tp-mr30">
								申请退款
							</view>
							<view v-if="[1,5].includes(item.status - 0)" @click="pageJumps('./scenicOrderDetail?id=')" class="btn tp-ptb0lr20 tp-h56 center_combo tp-bc tp-br12 tp-fcF tp-mr30">
								立即使用
							</view>
						</view> -->
					</view>
				</view>
				<!-- 景区 E -->

				<!-- 酒店 S -->
				<view class="tp-mt20" v-if="item.travelType == 10">
					<view class="level_align flex_between">
						<view class="tp-ptb0lr20 tp-h56 center_combo yellow-bg tp-fcF tp-br40">
							时间：{{item.useTime}}
						</view>
						<view class="tp-fc">酒店</view>
					</view>
					<view class="list-box tp-mt20 ">
						<view class="tp-br12  tp-bgf tp-ptb0lr30 tp-mb2" @click="pageJumps('./order/hotelOrderDetail?id=' + item.orderId)">
							<view class=" level_align  flex_between tp-fc333 tp-h88 tp-fz28">
								<view class="level_align">
									<text>订单号：</text>
									<text>{{item.orderNo}}</text>
								</view>
								<text class="tp-fz26 " :class="item.status == 4 ? 'tp-red' : 'tp-yellow'">{{item.orderDesc}}</text>
							</view>
							<view class="level_align ">
								<image class="list-img tp-br12 tp-mr20" :src="wwwImgUrl + item.hotelCover" mode="aspectFill"></image>
								<view class="flex-1 flex flex_column flex_between" style="height: 160rpx;">
									<view class=" tp-fc333  tp-fz28">
										<view class="ellispsis1 tp-fw600">
											{{item.hotelName}}
										</view>
										<view class="tp-mt10 tp-fz24 tp-fc666">
											{{item.inTime}} — {{item.outTime}}
										</view>
									</view>
									<view class="level_align flex_between">
										<view class="flex align_baseline tp-red">
											￥<text class=" tp-fz36 tp-fw600">{{item.roomCurrentPrice}}</text>
										</view>
										<view class="level_align flex_end">
											<text class="tp-mr20"> 共{{item.roomNum}}个房间</text>
											<text>{{item.status==0 ? '需付':'实付'}}￥{{item.totalRealAmount}}</text>
										</view>
									</view>
								</view>
							</view>
							<view class="level_align tp-h72 tp-fc333 flex_between tp-fz24">
								<view class="level_align">
									<text class="tp-mr15">下单时间：</text><text>{{item.createTime || ''}}</text>
								</view>
							</view>
						</view>
					<!-- 	<view class="btm-radius  tp-h98 level_align flex_end tp-bgf ">
							<view v-if="[1,5].includes(item.status - 0)" @click="handeHotelRefundDect(item)" class="btn tp-ptb0lr20 tp-h56 center_combo tp-bcF5 tp-br12 tp-fc666 tp-mr30">
								申请退款
							</view>
							<view v-if="[1,5].includes(item.status - 0)" @click="pageJumps('./hotelOrderDetail?id=')" class="btn tp-ptb0lr20 tp-h56 center_combo tp-bc tp-br12 tp-fcF tp-mr30">
								立即使用
							</view>
						</view> -->
					</view>
				</view>
				<!-- 酒店 E -->

				<!-- 旅游 S -->
				<view class="tp-mt20" v-if="item.travelType == 12">
					<view class="level_align flex_between">
						<view class="tp-ptb0lr20 tp-h56 center_combo yellow-bg tp-fcF tp-br40">
							时间：{{item.useTime}}
						</view>
						<view class="tp-fc">旅游</view>
					</view>
					<view class="list-box tp-mt20">
						<view class="top-radius tp-ptb0lr30 tp-bgf  tp-mb2" @click="pageJumps('./order/travelOrderDetail?id=' + item.orderId)">
							<view class=" level_align  flex_between tp-fc333 tp-h88 tp-fz28">
								<view class="level_align">
									<text>订单号：</text>
									<text>{{item.orderNo}}</text>
								</view>
								<text class="tp-fz26 " :class="item.status == 4 ? 'tp-red' : 'tp-yellow'">{{item.orderDesc}}</text>
							</view>
							<view class="level_align ">
								<image class="list-img tp-br12 tp-mr20" :src="wwwImgUrl +(item.travelGroupOrderInfoIntroVo && item.travelGroupOrderInfoIntroVo.travelCover && item.travelGroupOrderInfoIntroVo.travelCover)"
								 mode=""></image>
								<view class="flex-1 flex flex_column flex_between" style="height: 160rpx;">
									<view class=" tp-fc333  tp-fz28">
										<view class="ellispsis1 tp-fw600">
											{{item.travelGroupOrderInfoIntroVo && item.travelGroupOrderInfoIntroVo.travelName}}
										</view>
									</view>
									<view class="level_align flex_between">
										<view class="flex align_baseline tp-red">
											￥<text class=" tp-fz36 tp-fw600">{{item.travelGroupOrderInfoIntroVo && item.travelGroupOrderInfoIntroVo.currentPrice}}</text>
										</view>
										<view class="level_align tp-h72 tp-fc333 flex_end">
											<text>需付 ￥{{item.totalRealAmount}}</text>
										</view>
									</view>
					
								</view>
							</view>
							<view class="level_align tp-h72 tp-fc333 ">
								<view class="level_align">
									<text class="tp-mr15">下单时间：</text><text>{{item.createTime || ''}}</text>
								</view>
							</view>
						</view>
					</view>
				</view>
				<!-- 旅游 E -->

				<!-- 定制旅游 S -->
				<view class="tp-mt20" v-if="item.travelType == 14">
					<view class="level_align flex_between">
						<view class="tp-ptb0lr20 tp-h56 center_combo yellow-bg tp-fcF tp-br40">
							时间：{{item.useTime}}
						</view>
						<view class="tp-fc">定制旅游</view>
					</view>
					<view class="list-box tp-mt20">
						<view class="top-radius tp-ptb0lr30 tp-bgf  tp-mb2" @click="pageJumps('./order/makeOrderDetail?id=' + item.id)">
							<view class=" level_align  flex_between tp-fc333 tp-h88 tp-fz28">
								<view class="level_align">
									<view class="no-team tp-lh40 tp-br8 center_combo tp-fz22 tp-yellow" :class="item.applyTypeDesc == '个人定制' ? 'no-team' : 'yes-team'">
										{{item.applyTypeDesc}}
									</view>
								</view>
								<text class="tp-fz26 " :class="item.status == 8 ? 'tp-red' : 'tp-yellow'">{{item.statusDesc}}</text>
							</view>
							<view class="tp-fc333 tp-fz28 tp-pb30 tp-lh44">
								<view class="level_align">
									<text class="tp-fc666 tp-mr20">出发地：</text>
									<view class="ellispsis1 flex-1">{{item.startCity}}</view>
								</view>
								<view class="level_align">
									<text class="tp-fc666 tp-mr20">目的地：</text>
									<view class="ellispsis1 flex-1">{{item.endCitys}}</view>
								</view>
								<view class="level_align" v-if="[2,3,4,5,6,7,8,9,10,11,12].includes(item.status - 0)">
									<text class="tp-fc666 tp-mr20">出行日期：</text>
									<view class="ellispsis1 flex-1">{{item.startTime}}至{{item.outTime}}(共{{item.travelDay}}天)</view>
								</view>
								<view class="level_align">
									<text class="tp-fc666 tp-mr20">下单时间：</text>
									<view class="ellispsis1 flex-1">{{item.createTime}}</view>
								</view>
								<view class="level_align" v-if="[1,2].includes(item.status - 0)">
									<text class="tp-fc666 tp-mr20"><text class="tp-mr30">总 </text>计：</text>
									<view class="ellispsis1  tp-red flex level_align align_baseline tp-fz24">￥<text class="tp-fz36 tp-fw600">{{item.totalRealAmount}}</text></view>
								</view>
								<view class="level_align" v-if="[3].includes(item.status - 0)">
									<text class="tp-fc666 tp-mr20"><text class="tp-mr30">需 </text>付：</text>
									<view class="ellispsis1  tp-red flex level_align align_baseline tp-fz24">￥<text class="tp-fz36 tp-fw600">{{item.totalRealAmount}}</text></view>
								</view>
								<view class="level_align" v-if="[4,5,6,7,8,9,10,11,].includes(item.status - 0)">
									<text class="tp-fc666 tp-mr20"><text class="tp-mr30">实 </text>付：</text>
									<view class="ellispsis1  tp-red flex level_align align_baseline tp-fz24">￥<text class="tp-fz36">{{item.totalRealAmount}}</text></view>
								</view>
							</view>
					
						</view>
					</view>
				</view>
				<!-- 定制旅游 E -->
			</view>
		</view>
		<view class="uni-loadmore" v-if="showLoadMore">{{loadMoreText}}</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [], // 列表
				pageNum: 1, // 当前页码,请设置初始值
				last_page: null, // 总页数
				loadMoreText: "加载中...",
				showLoadMore: false, // 加载更多
				item: {
					status: 1,
					num: 1
				}
			};
		},
		onShow() {
			this.pageNum = 1
			this.getList()
		},
		// 下拉刷新
		onPullDownRefresh() {
			console.log('onPullDownRefresh');
			this.pageNum = 1
			this.loadMoreText = "加载中..."
			this.getList()
		},
		// 上拉触底
		onReachBottom() {
			this.showLoadMore = true;
			if (this.pageNum < this.last_page) {
				this.pageNum++
				this.getList()
			} else {
				this.loadMoreText = "已没有更多数据!"
			}
		},
		methods: {
			//获取列表
			getList() {
				this.$http.get(this.$api.travelHistory + '?pageSize=10&pageNum=' + this.pageNum)
					.then(res => {
						uni.stopPullDownRefresh();
						this.showLoadMore = false;
						if (res.code === 200) {
							this.last_page = res.data.pageTotal
							if (this.pageNum > 1) {
								this.list = this.list.concat(res.data.result);
							} else {
								this.list = res.data.result
							}
						}
					})
			},
			handleGoBusOrderDetail(data) {
				let {
					type
				} = data
				console.log(1111111);
				console.log(type);
				if (type == 0) { // 单程
					uni.navigateTo({
						url: '/pagesUser/order/bus.orderDetail?id=' + data.orderNo + '&hideBtn=true'  + '&status=' +
							data.status
					});
				} else if (type == 1) { // 往返程
					uni.navigateTo({
						url: '/pagesUser/order/bus.orderDetail?id=' + data.orderNo + '&hideBtn=true'  + '&toAndFor=true' +
							'&status=' + data.status
					});
				}
			},
		}
	}
</script>

<style lang="scss">
	.myJourney {
		.myJourney_ul {
			padding: 30rpx;

			.myJourney_li {
				.myJourney_li_head {
					padding: 20rpx 0;

					.myJourney_li_head_l {
						width: 260rpx;
						height: 48rpx;
						background: #FFAF3C;
						border-radius: 24rpx;
						color: #FFFFFF;
					}
				}

				.myJourney_li_main {
					background: #FFFFFF;
					border-radius: 12rpx;

					.myJourney_li_main_top {
						padding: 20rpx;
						border-radius: 12rpx 12rpx 0 0;

						.myJourney_li_main_top_l {
							.myJourney_li_main_top_l_btn {
								width: 66rpx;
								height: 40rpx;
								background: #FFF2E0;
								border-radius: 8rpx;
								color: #FFAF3C;
								font-size: 22rpx;
								margin-right: 20rpx;
							}

							.myJourney_li_main_top_l_time {
								color: #666666;
								font-size: 26rpx;
							}
						}

						.myJourney_li_main_top_r {
							color: #FFAF3C;
							font-size: 26rpx;
						}
					}

					.myJourney_li_main_con {
						padding: 40rpx 45rpx;
						border-top: 2rpx solid #EBEBEB;
						border-bottom: 2rpx solid #EBEBEB;
						border-radius: 0 0 12rpx 12rpx;
					}

					.myJourney_li_main_number {
						padding: 35rpx 20rpx;
						color: #666666;
						font-size: 26rpx;
					}
				}
			}
		}
	}

	.shift-wrap {
		display: flex;
		flex: 1;
		justify-content: space-between;

		.from,
		.to {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			line-height: 1;
			height: 100rpx;

			.time {
				font-size: 48rpx;
				font-weight: bold;
			}

			.address {
				font-size: 32rpx;
			}
		}

		.to {
			text-align: right;
		}

		.bus_type-wrap {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			font-size: 24rpx;
			color: #666;
			height: 100rpx;

			.dack {
				width: 170rpx;
				background-color: #ccc;
				height: 6rpx;
				position: relative;

				&::before {
					content: '';
					position: absolute;
					width: 35rpx;
					height: 6rpx;
					top: -11rpx;
					right: -7rpx;
					background-color: #ccc;
					transform: rotate(45deg);
				}
			}
		}
	}

	.yellow-bg {
		background: #FFAF3C;
	}

	.list-box {
		.top-radius {
			border-radius: 12rpx 12rpx 0 0;
		}

		.btm-radius {
			border-radius: 0 0 12rpx 12rpx;
		}

		.list-img {
			width: 190rpx;
			height: 160rpx;
		}
	}
	
	// 拼车
	.info_top-wrap {
		height: 80rpx;
		display: flex;
		align-items: center;
		font-size: 26rpx;
		justify-content: space-between;
		padding: 0 20rpx;
		border-radius: 12rpx 12rpx 0 0;

		.date {
			color: #666;
			display: flex;
			align-items: center;
	
			.type {
				display: inline-block;
				width: 66rpx;
				height: 40rpx;
				line-height: 40rpx;
				text-align: center;
				background-color: #FFF2E0;
				color: $yellow;
				font-size: 22rpx;
				margin-right: 20rpx;
				border-radius: 8rpx;
			}
		}
	
		.status {
			color: $yellow;
		}
	}
	
	.info_content-wrap {
		display: flex;
		flex: 1;
		align-items: center;
		justify-content: space-between;
		padding: 40rpx;
		border-top: 1px solid #ebebeb;
		border-bottom: 1px solid #ebebeb;
		border-radius: 0 0 12rpx 12rpx;
	
		.address-wrap {
			display: flex;
			flex: 1;
			flex-direction: column;
			justify-content: space-between;
			font-size: 30rpx;
			font-weight: bold;
			position: relative;
	
			.step-wrap {
				display: flex;
				justify-content: space-between;
				flex-direction: column;
				height: 90rpx;
				position: absolute;
				top: 6rpx;
				left: 0rpx;
	
				&::before {
					content: '';
					position: absolute;
					left: 50%;
					transform: translateX(-50%);
					height: 100%;
					width: 1px;
					background-color: #ccc;
				}
	
				.dot {
					height: 20rpx;
					width: 20rpx;
					border: 1px solid #ccc;
					border-radius: 50%;
					position: relative;
	
					&::before {
						content: '';
						position: absolute;
						left: 50%;
						top: 50%;
						transform: translate(-50%, -50%);
						height: 100%;
						width: 100%;
						border-radius: 50%;
						background-color: #fff;
					}
				}
			}
	
			.from,
			.to {
				display: flex;
				align-items: center;
				padding-left: 44rpx;
	
				.type {
					padding: 0 10rpx;
					background-color: #FFF2E0;
					color: $yellow;
					font-size: 22rpx;
					border-radius: 8rpx;
					margin-right: 20rpx;
					height: 40rpx;
					line-height: 40rpx;
					text-align: center;
				}
			}
	
			.from {
				margin-bottom: 20rpx;
			}
		}
	
		.price {
			color: $red;
			font-size: 36rpx;
			font-weight: bold;
		}
	}
	.no-team {
		width: 118rpx;
		background: #FFF2E0;
	}
	
	.yes-team {
		width: 118rpx;
		background: #FFE8E6;
	}
</style>
